<template>
  <UserList v-if="isIndex" @to-detail="handleToDetails"></UserList>
  <UserDetails v-else :detailInfo @to-list="isIndex = true"></UserDetails>
</template>

<script setup lang='ts' name="UserIndex">
import UserList from './UserList.vue';
import UserDetails from './UserDetails.vue';
const detailInfo = reactive<{
    data: Partial<OrderVO>;
    type: 'view' | 'add' | 'charge' | null;
}>({
    data:{},
    type:null 
})
const isIndex = ref(true);
const handleToDetails = (type: 'view' | 'add' | 'charge', row: Partial<OrderVO>) => {
    isIndex.value = false;
    Object.assign(detailInfo, {
        data: row,
        type
    });
};
</script>
<style scoped lang='scss'>
</style>